<?php

namespace App\Console\Commands\User;

use Illuminate\Console\Command;
use App\Models\User;

class GenerateUsersCommand extends Command
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'user:generate';

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'user:generate
        {count : How many users do you want to generate}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Generate some fake users';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        // 获取参数
        $count = $this->argument('count');
        $count = intval($count);
        factory(\App\Models\User::class, $count)->create();
        factory(\App\Models\Hobby::class, $count * 10)->create();

        // 查找用户
        $this->info('Ok');
    }
}
